package test3;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class TestNetServer {

	public static void main(String[] args) throws Exception{
		ServerSocket server=new ServerSocket(7777);
		//block Thread
		Socket sk=server.accept();
		InputStream in=sk.getInputStream();
		BufferedReader reader=new BufferedReader(new InputStreamReader(in));
		
		//block Thread
		String line=reader.readLine();
		System.out.println(line);
		OutputStream out=sk.getOutputStream();
		out.write("Hello I am Server".getBytes("UTF-8"));
		
		out.close();
		sk.close();
		server.close();

	}

}
